package com.base.api;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@Data
public class Message implements Serializable{

    /**
     * 消息的唯一ID
     */
    private String messageId;

    /**
     * 消息的主题
     */
    private  String topic;

    /**
     * 消息的路由规则
     */
    private String routingKey="";

    /**
     * 消息的附加属性
     *
     */
    private Map<String,Object> attribute=new HashMap<String,Object>();

    /**
     * 延迟消息的参数配置
     */
    private int delayMills;

    /**
     * 消息类型:默认为confirm消息
     */
    private String messageType=MessageType.CONFRIM;

    public Message(){}

    public Message(String messageId, String topic, String routingKey, Map<String, Object> attribute, int delayMills) {
        this.messageId = messageId;
        this.topic = topic;
        this.routingKey = routingKey;
        this.attribute = attribute;
        this.delayMills = delayMills;
    }

    public Message(String messageId, String topic, String routingKey, Map<String, Object> attribute, int delayMills, String messageType) {
        this.messageId = messageId;
        this.topic = topic;
        this.routingKey = routingKey;
        this.attribute = attribute;
        this.delayMills = delayMills;
        this.messageType = messageType;
    }
}
